#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=1e5;
typedef long long LL;
const LL mod=1e9+7;
inline LL ksm(LL x,LL a){
	LL ret=1,k=x;
	for (;a;a>>=1,k=k*k%mod)
		if (a&1) ret=ret*k%mod;
	return ret%mod;
}
int main(void)
{
  cin.tie(0);std::ios::sync_with_stdio(false);

    LL n;cin>>n;
    LL ans=1;
    for(LL i=1;i<=n;i++){
        ans=(ans%mod*i%mod)%mod;
    }
    LL res=ksm(2,n-1);
    cout<<(ans%mod-res%mod+mod)%mod<<endl;
return 0;
}
